package com.wsh.generator;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wsh.mapper.generator.MySqlGenerCodeDao;
import com.wsh.utils.PageUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 数据表业务接口
 */
@Service
public class GenerCodeService {

    @Resource
    private MySqlGenerCodeDao mySqlGenerCodeDao;

    public IPage list(Map<String, Object> params) {
        Page<Map<String, Object>> pages = PageUtils.getPage(params);
        pages.setRecords(mySqlGenerCodeDao.queryList(pages));
        return pages;
    }

    public Map<String, String> queryTable(String tableName) {
        return this.mySqlGenerCodeDao.queryTable(tableName);
    }

    public List<Map<String, String>> queryColumns(String tableName) {
        return this.mySqlGenerCodeDao.queryColumns(tableName);
    }

}
